package com.anxin;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import com.anxin.service.DepartmentService;

@SpringBootApplication
public class AnxinSystemApplication {
    public static void main(String[] args) {
        SpringApplication.run(AnxinSystemApplication.class, args);
    }

    // 启动时预加载科室树到缓存
    @Bean
    public CommandLineRunner preloadDepartmentTree(DepartmentService departmentService) {
        return args -> {
            departmentService.getDepartmentTree();
        };
    }
}
